// var i;
// var $uI_BoxUpLevel_UIBindings = require("./UI_BoxUpLevel_UIBindings");
// var $uIView = require("./UIView");
// var $excel = require("./Excel");
// var $hallManager = require("./HallManager");
// var d = cc._decorator;
// var p = d.ccclass;
// var h = d.property;
// var f = d.inspector;
// var g = (function (e) {
//     function t() {
//         var t = (null !== e && e.apply(this, arguments)) || this;
//         t.auto_ui = null;
//         return t;
//     }
//     __extends(t, e);
//     t.prototype._show = function (e) {
//         var t = this;
//         var o = [];
//         for (var n = 1; n < arguments.length; n++) {
//             o[n - 1] = arguments[n];
//         }
//         this.ShowLevel($hallManager.HallMgr.shopData.boxLevel);
//         this.auto_ui.node_lightNode.stopAllActions();
//         this.auto_ui.node_lightNode.runAction(cc.repeatForever(cc.rotateBy(3, 360)));
//         this.auto_ui.btn_closeBtn.node.active = !1;
//         this.scheduleOnce(function () {
//             t.auto_ui.btn_closeBtn.node.active = !0;
//         }, 2);
//     };
//     t.prototype._clickListener = function (e) {
//         switch (e) {
//             case this.auto_ui.btn_closeBtn:
//                 this._close();
//                 this.auto_ui.node_lightNode.stopAllActions();
//                 this.auto_ui.btn_closeBtn.node.active = !1;
//         }
//     };
//     t.prototype.ShowLevel = function (e) {
//         var t = this.auto_ui;
//         t.txt_levelLabel.string = "l" + (e + 1);
//         var o = $excel.Excel.shopBoxLevel(e);
//         var n = $excel.Excel.shopBoxLevel(e + 1);
//         t.txt_box1LvLabel.node.parent.active = n.rewards[0] > 0;
//         t.txt_box1LvLabel.string = "+" + (n.rewards[0] - o.rewards[0]);
//         t.txt_box1LanLabel.node.parent.active = n.rewards[1] > 0;
//         t.txt_box1LanLabel.string = "+" + (n.rewards[1] - o.rewards[1]);
//         t.txt_box1ZiLabel.node.parent.active = n.rewards[2] > 0;
//         t.txt_box1ZiLabel.string = "+" + (n.rewards[2] - o.rewards[2]);
//         t.txt_box2LvLabel.node.parent.active = n.bigRewards[0] > 0;
//         t.txt_box2LvLabel.string = "+" + (n.bigRewards[0] - o.bigRewards[0]);
//         t.txt_box2LanLabel.node.parent.active = n.bigRewards[1] > 0;
//         t.txt_box2LanLabel.string = "+" + (n.bigRewards[1] - o.bigRewards[1]);
//         t.txt_box2ZiLabel.node.parent.active = n.bigRewards[2] > 0;
//         t.txt_box2ZiLabel.string = "+" + (n.bigRewards[2] - o.bigRewards[2]);
//     };
//     __decorate([h($uI_BoxUpLevel_UIBindings.default)], t.prototype, "auto_ui", void 0);
//     return __decorate([p], t);
// })($uIView.default);
// exports.default = g;


// import UI_BoxUpLevel_UIBindings from "./UI_BoxUpLevel_UIBindings";
// import UIView from "./UIView";
// import { Excel }  from "./Excel";
// import { HallMgrInstance } from "./HallManager";

// const { ccclass, property, inspector } = cc._decorator;

// /**
//  * 建议类名：BoxUpLevelUI
//  */
// @ccclass
// class UI_BoxUpLevel extends UIView {
//     @property(UI_BoxUpLevel_UIBindings)
//     auto_ui: any = null;

//     constructor() {
//         super();
//     }

//     /**
//      * 显示界面
//      * @param e - 事件参数
//      * 建议方法名：showUI
//      */
//     _show(e: any, ...args: any[]): void {
//         this.ShowLevel(HallMgrInstance.shopData.boxLevel);
//         this.auto_ui.node_lightNode.stopAllActions();
//         this.auto_ui.node_lightNode.runAction(cc.repeatForever(cc.rotateBy(3, 360)));
//         this.auto_ui.btn_closeBtn.node.active = false;
//         this.scheduleOnce(() => {
//             this.auto_ui.btn_closeBtn.node.active = true;
//         }, 2);
//     }

//     /**
//      * 点击事件监听器
//      * @param e - 事件参数
//      * 建议方法名：clickListener
//      */
//     _clickListener(e: cc.Button): void {
//         switch (e) {
//             case this.auto_ui.btn_closeBtn:
//                 this._close();
//                 this.auto_ui.node_lightNode.stopAllActions();
//                 this.auto_ui.btn_closeBtn.node.active = false;
//                 break;
//         }
//     }

//     /**
//      * 显示等级信息
//      * @param e - 等级参数
//      * 建议方法名：displayLevel
//      */
//     ShowLevel(e: number): void {
//         const t = this.auto_ui;
//         t.txt_levelLabel.string = "l" + (e + 1);
//         const o = Excel.shopBoxLevel(e);
//         const n = Excel.shopBoxLevel(e + 1);

//         t.txt_box1LvLabel.node.parent.active = n.rewards[0] > 0;
//         t.txt_box1LvLabel.string = "+" + (n.rewards[0] - o.rewards[0]);

//         t.txt_box1LanLabel.node.parent.active = n.rewards[1] > 0;
//         t.txt_box1LanLabel.string = "+" + (n.rewards[1] - o.rewards[1]);

//         t.txt_box1ZiLabel.node.parent.active = n.rewards[2] > 0;
//         t.txt_box1ZiLabel.string = "+" + (n.rewards[2] - o.rewards[2]);

//         t.txt_box2LvLabel.node.parent.active = n.bigRewards[0] > 0;
//         t.txt_box2LvLabel.string = "+" + (n.bigRewards[0] - o.bigRewards[0]);

//         t.txt_box2LanLabel.node.parent.active = n.bigRewards[1] > 0;
//         t.txt_box2LanLabel.string = "+" + (n.bigRewards[1] - o.bigRewards[1]);

//         t.txt_box2ZiLabel.node.parent.active = n.bigRewards[2] > 0;
//         t.txt_box2ZiLabel.string = "+" + (n.bigRewards[2] - o.bigRewards[2]);
//     }
// }

// export default UI_BoxUpLevel;

import UIBoxUpLevelUIBindings from "./UI_BoxUpLevel_UIBindings";
import UIViewBase from "./UIView";
import { Excel } from "./Excel";
import { HallMgr } from "./HallManager";

const { ccclass, property, inspector } = cc._decorator;

/**
 * 建议类名：BoxUpLevelUI
 */
@ccclass
class ViewBoxUpLevel extends UIViewBase {
    @property(UIBoxUpLevelUIBindings)
    auto_ui: any = null;

    constructor() {
        super();
    }

    /**
     * 显示界面
     * @param event - 事件参数
     * 建议方法名：showUI
     */
    _show(event: any, ...args: any[]): void {
        this.showLevel(HallMgr.shopData.boxLevel);
        this.auto_ui.node_lightNode.stopAllActions();
        this.auto_ui.node_lightNode.runAction(cc.repeatForever(cc.rotateBy(3, 360)));
        this.auto_ui.btn_closeBtn.node.active = false;
        this.scheduleOnce(() => {
            this.auto_ui.btn_closeBtn.node.active = true;
        }, 2);
    }

    /**
     * 点击事件监听器
     * @param event - 事件参数
     * 建议方法名：clickListener
     */
    _clickListener(event: cc.Button): void {
        switch (event) {
            case this.auto_ui.btn_closeBtn:
                this._close();
                this.auto_ui.node_lightNode.stopAllActions();
                this.auto_ui.btn_closeBtn.node.active = false;
                break;
        }
    }

    /**
     * 显示等级信息
     * @param level - 等级参数
     * 建议方法名：displayLevel
     */
    showLevel(level: number): void {
        const uiBindings = this.auto_ui;
        const currentLevelRewards = Excel.shopBoxLevel(level);
        const nextLevelRewards = Excel.shopBoxLevel(level + 1);

        uiBindings.txt_levelLabel.string = "l" + (level + 1);

        uiBindings.txt_box1LvLabel.node.parent.active = nextLevelRewards.rewards[0] > 0;
        uiBindings.txt_box1LvLabel.string = "+" + (nextLevelRewards.rewards[0] - currentLevelRewards.rewards[0]);

        uiBindings.txt_box1LanLabel.node.parent.active = nextLevelRewards.rewards[1] > 0;
        uiBindings.txt_box1LanLabel.string = "+" + (nextLevelRewards.rewards[1] - currentLevelRewards.rewards[1]);

        uiBindings.txt_box1ZiLabel.node.parent.active = nextLevelRewards.rewards[2] > 0;
        uiBindings.txt_box1ZiLabel.string = "+" + (nextLevelRewards.rewards[2] - currentLevelRewards.rewards[2]);

        uiBindings.txt_box2LvLabel.node.parent.active = nextLevelRewards.bigRewards[0] > 0;
        uiBindings.txt_box2LvLabel.string = "+" + (nextLevelRewards.bigRewards[0] - currentLevelRewards.bigRewards[0]);

        uiBindings.txt_box2LanLabel.node.parent.active = nextLevelRewards.bigRewards[1] > 0;
        uiBindings.txt_box2LanLabel.string = "+" + (nextLevelRewards.bigRewards[1] - currentLevelRewards.bigRewards[1]);

        uiBindings.txt_box2ZiLabel.node.parent.active = nextLevelRewards.bigRewards[2] > 0;
        uiBindings.txt_box2ZiLabel.string = "+" + (nextLevelRewards.bigRewards[2] - currentLevelRewards.bigRewards[2]);
    }
}

export default ViewBoxUpLevel;